
//
// 120515 - AH - Created.
// 120727a- AH - (Midtun) Now extends ParametersSerializable and removed code
//               that now is in base class.
// 120727b- AH - (Midtun *) Missing java doc.
// 120728 - AH - EMPTY_ARRAY.
//

package org.soekrat.server.serialization;

import java.util.Map;

import org.soekrat.server.io.db.SemanticEffect;

/**
 * <p>
 *   Describes a semantic effect.
 * </p>
 * @author Arne Halvorsen (AH)
 * @author Laetitia Le Chatton (LLC)
 */
public final class SemanticEffectSerializable extends ParametersSerializable 
{
  private static final long serialVersionUID=711294248410778964L;
  
  private String name;
  
  /**
   * <p>
   *   Constructor.
   * </p>
   * @param se {@link SemanticEffect} to represent.
   */
  public SemanticEffectSerializable(SemanticEffect se)
  {
    if (se==null)
    {
      throw new NullPointerException("se");  
    }
    
    name=se.getName();
    
    Map<String, String> params=se.getParameterMap();
    for (Map.Entry<String, String> curr : params.entrySet())
    {
      parameter(curr.getKey(), curr.getValue());  
    }
    
    if (name!=null)  parameter("name", name);
  }
  
  /**
   * <p>
   *   Gets name.
   * </p>
   * @return Name.
   */
  public String getName(){ return this.name; }
  
  /**
   * <p>
   *   Empty array shared.
   * </p>
   */
  public static final SemanticEffectSerializable[] EMPTY_ARRAY=
    new SemanticEffectSerializable[0]; 
  
}
